#ifndef _BINSTREE_H
#define _BINSTREE_H

#define ROW 20
#define COL 20
typedef int  elemType;
typedef enum{FALSE, TRUE} BOOL;
typedef  struct Nodestru * ptrNode, *BinSearchTree;
ptrNode addrBuf[ROW][COL];

struct Nodestru{
    elemType  value;
    ptrNode lchild;
    ptrNode rchild;
};

void BST_postOrder(ptrNode node);
void BST_inOrder(ptrNode node);
void  BST_preOrder(ptrNode node);

void BST_insert(ptrNode *node, elemType elem);
ptrNode BST_create(ptrNode *node, elemType elem);

int BST_rowOrder_endIndex(ptrNode * array);//return count of vaild elems;
void BST_rowOrderRecursion(ptrNode node, int row);
ptrNode BST_parent(ptrNode node , elemType elem);
ptrNode BST_findNode(ptrNode const node, elemType const elem);
void BST_updateAddrBuf(ptrNode node);
BOOL BST_addrBufPostion(ptrNode node , int *row, int *col);
#endif // _BINSTREE_H
